#ifndef __RED_TUPLE_OBJECT_H__
#define __RED_TUPLE_OBJECT_H__

#include "redobject.h"

typedef struct _RedTupleObject
{
	RedObject_HEAD

	int			 tu_length;
	RedObject	*tu_items[0];
} RedTupleObject;

RED_EXPORT extern RedTypeObject RedType_Tuple;

#define RedTuple_Exact(o)		((o)->ob_type == &RedType_Tuple)
#define RedTuple_Items(o)		(((RedTupleObject *)(o))->tu_items)
#define RedTuple_Length(o)		(((RedTupleObject *)(o))->tu_length)

RED_EXPORT RedObject *RedTuple_FromLength(int length);
RED_EXPORT RedObject *RedTuple_FromObjects(int length, ...);

RED_EXPORT RedObject *RedTuple_Append(RedObject *self, RedObject *item);
RED_EXPORT RedObject *RedTuple_Concat(RedObject *self, RedObject *other);
RED_EXPORT RedObject *RedTuple_GetItem(RedObject *self, RedObject *index);

/* this function does NOT increase ref-count */
RED_EXPORT char RedTuple_Unpack(RedObject *self, const char *format, ...);

#endif /* __RED_TUPLE_OBJECT_H__ */
